package com.zlsy.springbootdemo.abstractfactory.demo.shape;

import com.zlsy.springbootdemo.abstractfactory.demo.AbstractFactory;
import com.zlsy.springbootdemo.abstractfactory.demo.color.Color;

/**
 * @author zhouliang
 * @date 2021/1/22 10:13
 */
public class ShapeFactory extends AbstractFactory {

  @Override
  public Color getColor(String color) {
    return null;
  }

  @Override
  public Shape getShape(String shapeType) {
    if (shapeType == null) {
      return null;
    }
    if (shapeType.equalsIgnoreCase("CIRCLE")) {
      return new Circle();
    } else if (shapeType.equalsIgnoreCase("RECTANGLE")) {
      return new Rectangle();
    } else if (shapeType.equalsIgnoreCase("SQUARE")) {
      return new Square();
    }
    return null;
  }
}
